home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / Debug Build of OpenDoc / Debug Menu Read Me < prev   
Encoding:
Text File  |  1996-04-22  |  5.3 KB  |  58 lines  |  [ttro/ttxt]

  1. KickStart Installation
  2. By The OpenDoc™ Engineering Team
  3. November 7, 1995
  4.  
  5.  
  6. © 1996  Apple Computer, Inc. All Rights Reserved.
  7. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  8. Mac and OpenDoc are trademarks of Apple Computer, Inc.
  9. ------------------------------------------------------------------------------------------------------------------------------
  10.  
  11. The Debug build of OpenDoc™ (see "Read Me - Debug Build" in this folder) includes a menu called "ODDebug", which appears just below the "About..." command in the Apple menu. This menu includes commands that let you access a number of cool debugging features.
  12.  
  13. HEAP INFO
  14. Displays an alert with information on the memory usage of the OpenDoc heap (which lives in temporary memory) and the application heap.
  15.  
  16. MEMORY VALIDATION
  17. Toggles the validation mode of the OpenDoc memory manager; this is normally on in the debug build. In this mode parameters to memory manager calls are sanity-checked. It also fills blocks with hex "BBBB" when they are created, and "DDDD" after they're disposed, to help track down errors where you reference storage that's either uninitialized or disposed. This slows things down somewhat, but not really noticeably. There should be little reason to turn it off.
  18.  
  19. HEAP CHECKING
  20. This is an intense version of memory validation. On every memory manager call, the entire heap is scanned to make sure it has not been corrupted. This will slow OpenDoc down by an order of magnitude or so, so you don't want to turn it on unless it's absolutely necessary. But it can be very useful in catching strange memory-trashing bugs. (You can also turn this on programmatically; see the "Memory Manager" tech note in the Tech Notes folder on this CD.
  21.  
  22. LEAK DETECTION
  23. Helps detect memory leaks in the OpenDoc heap, in a manner similar to the venerable 'leaks' dcmd for MacsBug. How to use it:
  24. 1. First turn on logging. 
  25. 2. Choose "Leak Detection" from the ODDebug menu.
  26. 3. Perform an operation (e.g. activating and deactivating your part) three or more times in a row. It has to be an operation involving this document, and it can't involve closing the document. Nearly anything else goes.
  27. 4. Choose "Leak Detection" again to turn off this mode.
  28. 5. A list of stack crawls representing allocations of blocks that were never disposed will be written to the log. Only situations that occurred three or more times will be shown, so as not to show one-time allocations that might represent some kind of caching. 
  29. This command will not detect memory leaks in the application heap. You can use the regular 'leaks' dcmd (available on the developer Tool Chest CD) to do that.
  30.  
  31. EAT MEMORY
  32. Allocates a 32k handle in the application heap every time this command is chosen. If you do this enough times, you'll run the heap out of memory, which is useful in checking how well things work in low-memory situations. (Remember that most OpenDoc memory allocation should take place in the OpenDoc heap, which lives in temporary memory, not the application heap. See the "Memory Etiquette" tech note.) 
  33.  
  34. PURGE
  35. Calls Purge( ) on the global ODSession object, which in turn tells most other OpenDoc objects (including all parts) to purge. This is useful in debugging low-memory behavior, including your part's Purge method. 
  36.  
  37. LOG TO STDOUT FILE
  38. Turns on logging, with the destination being a file called "stdout", usually in the same folder as the open document. If there is already a file called "stdout", the new one will be called "stdout1", et cetera.
  39.  
  40. The output written to the log comes from somPrintf( ) statements. This is a standard System Object Model™ (SOM) function that is called the same way as normal printf. You can call it yourself to have your part write info to the log; this is a useful last-ditch debugging tool. (A useful variant is the PRINT() macro defined in ODDebug.h, which does not generate any code if you compile your part with ODDebug=0.) Various parts of OpenDoc also write to the log. In particular, when an exception is thrown a stack crawl and the error number will be written to the log.
  41. To turn off logging, choose this command again.
  42.  
  43. LOG TO DEBUGWINDOW
  44. Turns on logging (see above) but directs output to the DebugWindow app, which is supplied on this CD. Launch the app before you turn logging on. This is handy in that it lets you watch the log statements appear as they happen. However, it's a lot slower than writing to the stdout file.
  45.  
  46. GENERATE DEBUGSTRS
  47. Turns on logging (see above) but displays the output by calling DebugStr. This is generally pretty annoying but can occasionally be useful. 
  48.  
  49. DUMP ODOBJECTS
  50. Available only when logging is turned on. This command searches the OpenDoc heap for SOM objects and writes the location, size and class name of each one to the log. 
  51.  
  52. BREAK ON THROW
  53. This is a toggle switch; when on, any exceptions thrown by OpenDoc itself (not by parts, other than the engineering test parts such as Container) will cause a WARNing DebugStr. This is a very useful way to find out where an exception thrown by OpenDoc is coming from.
  54.   You can programmatically enable this behavior in your own part (if you use the Except utility) by calling SetBreakOnThrow, declared in Except.h.
  55.  
  56. SOM TRACE
  57. Turns on SOM trace mode, in which every SOM method call — in OpenDoc or a part — causes a line describing the function to be written to the log. 
  58.